1. Field of the Invention
The present invention relates generally to computer systems and, in particular, to caching of stack memory architectures.
2. Discussion of Related Art
A typical computing system includes a processing unit and a memory unit. Most computing systems use random access memory architectures for the memory unit. Typically, fast memory circuits cost significantly more than slower memory circuits. Therefore, most memory units include a small but fast memory buffer called a cache and a slower main memory buffer. Various caching architectures for random access memory are well known in the art.
However, some computing systems use a stack architecture for the memory unit. A classical stack memory unit uses a last in first out access model. Conceptually, new data entering a stack memory unit is placed on top of the existing data, i.e., in the next available memory location. If data is requested from the stack, the last piece of data "on top of" the stack comes out first. For certain applications, stack-based memory architectures provide several advantages over random access memory architectures. For example, a stack memory architecture is well suited for a calculator using RPN notation.
Like random access memory based computing systems, many stack-based computing systems, including those implementing the JAVA virtual machine, use relatively slow memory devices to store the stack. In general, adding a cache for slow memory devices increases overall memory performance only if the vast majority of memory requests result in cache hits, i.e. the requested memory address is within the cache. Conventional cache designs are designed for random access memory architectures and do not perform well with stack-based memory architectures. Therefore, a caching method and a caching apparatus targeted to improve stack-based memory architectures are desirable.